package spring.cloud.tasks.executor.executor.task.task_configuration;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import spring.cloud.tasks.common.nodepaths.TaskBaseInfoNode;
import spring.cloud.tasks.common.nodepaths.TaskNodePaths;


@Slf4j
@Setter
@Getter
public final class TaskConfigurationNode {

    public static final String root_node = "task_configuration";


    public static final String task_item_total_count = root_node + "/task_item_total_count";


    public static final String cron_expression_update_id = root_node + "/cron_expression_update_id";


    public static final String task_item_parameters = root_node + "/task_item_parameters";

    public static final String task_parameter = root_node + "/task_parameter";


    public static final String show_normal_log = root_node + "/show_normal_log";


    public static final String load_Level = root_node + "/load_Level";


    /**
     * 自定义上下文
     */
    public static final String custom_context = root_node + "/custom_context";


    /**
     * 判断是否为任务调度配置路径.
     *
     * @param path 节点路径
     * @return 是否为任务调度配置路径
     */
    public static boolean isBaseInfoNodePath(final String taskId, final String path) {
        return TaskNodePaths.getTaskNodePath(taskId, TaskBaseInfoNode.baseInfoNode).equals(path);
    }

    public static boolean isEnabledPath(final String taskId, final String path) {
        return TaskNodePaths.getTaskNodePath(taskId, TaskNodePaths.enabled).equals(path);
    }

    public static boolean isToDeletePath(final String taskId, final String path) {
        return TaskNodePaths.getTaskNodePath(taskId, TaskNodePaths.to_delete).equals(path);
    }

    public static boolean isDeletePath(final String taskId, final String path) {
        return TaskNodePaths.getTaskNodePath(taskId, TaskNodePaths.delete).equals(path);
    }

}
